//
//  ActivityDetailView.m
//  豆瓣2
//
//  Created by dllo on 15/11/6.
//  Copyright (c) 2015年 张鸿峰. All rights reserved.
//

#import "ActivityDetailView.h"

#import "UIImageView+WebCache.h"

@implementation ActivityDetailView

- (void)dealloc
{
    [_label release];
    [_imageV release];
    [_contentLabel release];
    [_activityList release];
    [super dealloc];
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        [self creatSubviews];
    }
    return self;
}

- (void)creatSubviews
{
    self.label = [[UILabel alloc] initWithFrame:CGRectMake(20, 80, 375 - 40, 40)];
//    self.label.backgroundColor = [UIColor orangeColor];
    self.label.font = [UIFont systemFontOfSize:25];
    [self addSubview:self.label];
    [self.label release];
    
    self.imageV = [[UIImageView alloc] initWithFrame:CGRectMake(self.label.frame.origin.x, self.label.frame.origin.y + self.label.frame.size.height + 20, 130, 150)];
//    self.imageV.backgroundColor = [UIColor orangeColor];
    [self addSubview:self.imageV];
    [self.imageV release];
    
    self.contentLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.imageV.frame.origin.x, self.imageV.frame.origin.y + self.imageV.frame.size.height + 60, 375 - 2 * self.imageV.frame.origin.x, 250)];
//    self.contentLabel.backgroundColor = [UIColor grayColor];
    [self addSubview:self.contentLabel];
    [self.contentLabel release];
}

- (void)setActivityDetail:(ActivityDetail *)activityDetail
{
    if (_activityDetail != activityDetail) {
        
        [_activityDetail release];
        _activityDetail = [activityDetail retain];
    }
//    NSLog(@"6666======%@",_activityDetail.content);
    self.contentLabel.text = _activityDetail.content;
    //无限行
    self.contentLabel.numberOfLines = 0;
}


- (void)setActivityList:(ActivityList *)activityList
{
    if (_activityList != activityList) {
        
        [_activityList release];
        _activityList = [activityList retain];
    }
    self.label.text = _activityList.title;
    NSURL *url = [NSURL URLWithString:self.activityList.image];
    [self.imageV sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"placeHoderImage.png"]];
    
}



/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
